updating oE db_select
db_select
include eds.e namespace eds public function db_select(sequence path, integer lock_method = - 1)
chooses a new, already open, database to be the current database.
Parameters:
- path : a sequence, the path to the database to be the new current database.
- lock_method : an integer. Optional locking method.
Returns:
An integer, DB_OK on success or an error code.
Comments:
- Subsequent database operations will apply to this database. path is the path of the database file as it was originally opened with db_open or db_create.
- When you create (db_create) or open (db_open) a database, it automatically becomes the current database. Use db_select when you want to switch back and forth between open databases, perhaps to copy records from one to the other. After selecting a new database, you should select a table within that database using db_select_table.
- If the lock_method is omitted and the database has not already been opened, this function will fail. However, if lock_method is a valid lock type for db_open and the database is not open yet, this function will attempt to open it. It may still fail if the database cannot be opened.
Example 1:
if db_select("employees") != DB_OK then puts(2, "Could not select employees database\n") end if
Example 2:
if db_select("customer", DB_LOCK_SHARED) != DB_OK then puts(2, "Could not open or select Customer database\n") end if
See Also:
Not Categorized, Please Help
|